package top.frsf.pattern.c_behavioral.a_strategy.source.factory;

import top.frsf.pattern.c_behavioral.a_strategy.source.enums.DbType;
import top.frsf.pattern.c_behavioral.a_strategy.source.service.AbstractQuery;
import top.frsf.pattern.c_behavioral.a_strategy.source.service.impl.MysqlQuery;
import top.frsf.pattern.c_behavioral.a_strategy.source.service.impl.OracleQuery;

/**
 * 策略工厂类
 *
 * @author He Kuntao
 * @since 2024/8/16 16:48
 */
public class QueryFactory {
    public static AbstractQuery createQuery(DbType dbType) {
        switch (dbType) {
            case MYSQL:
                return new MysqlQuery();
            case ORACLE:
                return new OracleQuery();
            default:
                throw new IllegalArgumentException("Unsupported database type: " + dbType);
        }
    }
}